package com.bolt.auth.security.admin.biz.sys.service;


import com.bolt.auth.admin.api.sys.dto.DictDTO;
import com.bolt.auth.admin.api.sys.dto.converter.DictConverter;
import com.bolt.auth.admin.api.sys.entity.DictEntity;
import com.bolt.auth.security.admin.biz.sys.repository.DictRepository;
import com.bolt.support.base.service.BaseService;
import com.bolt.support.spring.jpa.repository.BasicJpaRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
* Auto Generate Javadoc
* @author
* 日期:2020-10-23 17:16:08
* 数据字典
**/
@Service
@Transactional(readOnly = true,rollbackFor = Exception.class)
public class DictService extends BaseService<DictEntity, Long>{
    
    @Autowired
    private DictRepository dictRepository;

    @Override
    protected BasicJpaRepository<DictEntity, Long> getRepository() {
        return dictRepository;
    }

    @Transactional(rollbackFor = Exception.class)
    public void saveOrUpdate( DictDTO dto) {
       DictEntity entity = DictConverter.toEntity(dto);
        save(entity);
    }

}
